Repository navigation
[wip] Components package - #14
Conversation
Note the size of the bundled JS: $ npm run build > @hyparam/components@0.1.0 build > tsc -b ./tsconfig.lib.json && vite build vite v5.4.10 building for production... ✓ 39 modules transformed. [vite:dts] Start generate declaration files... computing gzip size (0)...[vite:dts] Declaration files built in 2044ms. dist/main.es.js 234.34 kB │ gzip: 123.03 kB │ map: 119.65 kB dist/main.umd.js 223.48 kB │ gzip: 121.78 kB │ map: 116.58 kB ✓ built in 2.79s
it prepares the way to parse Hugging Face URLs
| interface ViewerProps { | ||
| file: string | ||
| setError: (error: Error) => void | ||
| parsedKey: UrlKey | FileKey |
There was a problem hiding this comment.
not sure that parsedKey is the name I would go for here. Maybe content? In the other repo I moved toward ViewerProps accepting:
interface ViewerProps {
content: AsyncBufferFrom
...
}
export type AsyncBufferFrom = FileContent<void> | AsyncBufferFromFile
So basically solving the same problem but slightly different names. Ultimately what's important is that it is an object that defines how to construct an AsyncBuffer object. It needs to be a serializable object so that we can send it to the webworker. And the two cases are either: from a url or from a dropped file.
In the case of a UrlKey: it should also include a byteLength property. Why? Otherwise we might need to make a HEAD request every time we want to construct an AsyncBuffer.
This is ok for now for merging the PR. We can evolve this over time. But I think both repos have not found exactly the right abstraction here.
There was a problem hiding this comment.
exactly! I couldn't find a good name, and key is a reserved word in React so we cannot use it to pass the data as key={key}.
Note that my intent is also to do the URL/path parsing once, and avoid doing it again (will be maybe more important when we will include the parsing of HF URLs, since the different parts of the URL have different meanings, see https://github.com/severo/hyparam--space/blob/main/src/lib/huggingface.ts).
Maybe the abstraction is somewhat like a filesystem (as in https://filesystem-spec.readthedocs.io): being able to handle and navigate through files stored locally, remotely on a standard HTTP hosting, on S3, on HF, inside ZIP, etc. using the same code.
platypii
left a comment
There was a problem hiding this comment.
Looks good. Only minor comments. Also there's a test failing due to multiple matches of / instead of just one. not sure why that changed in the dom?
Approved conditional on tests passing. 👍
OK, the culprit was: 79894fd#diff-6af28ba0149c36fb2e0a4050a592e6c070d37f04359a949ccb21b39fa05e5583R42 Fixed. |
22cc4a9 to
e637788
Compare
|
Merging! Tomorrow, I'll start creating PRs (or issues) for the points listed in the description |
Missing:
Then, follow-up work (check means an issue/PR has been created):
TODO(SL)and create issues instead/files?key=or/api/store/get?key=parsedKeyand find the correct abstraction ([wip] Components package #14 (comment))